import { VxeFormItemProps, VxeGridPropTypes } from '@gui-pkg/antdcomponents';
import { useModal } from '@gui-pkg/antdcomponents';

const [registerMapModal, { openModal: openMapModal }] = useModal();
const townData = [

  {value: '大金镇', label: '大金镇'},
  {value: '四望镇', label: '四望镇'},
  {value: '梅川镇', label: '梅川镇'},
  {value: '花桥镇', label: '花桥镇'},
  {value: '田家镇街道', label: '田家镇街道'},
  {value: '余川镇', label: '余川镇'},
  {value: '大法寺镇', label: '大法寺镇'},
  {value: '刊江街道', label: '刊江街道'},
]
export const columns: VxeGridPropTypes.Columns = [
  {
    title: '测站名称',
    field: 'stnm',
    align: 'center',
    fixed: 'left',
  },
  {
    title: '镇',
    field: 'town',
    align: 'center',
  },
  {
    title: '编码',
    field: 'stcd',
    align: 'center',
  },
  {
    title: '设备编码',
    field: 'eqId',
    align: 'center',
  },
  {
    title: '设备卡号',
    field: 'eqNo',
    align: 'center',
  },
  {
    title: '设备状态',
    field: 'eqStatus',
    align: 'center',
  },
  {
    title: '操作',
    align: 'center',
    slots: { default: 'action' },
  },
];

export const searchFormSchema: VxeFormItemProps[] = [
  {
    field: 'keywords',
    title: '快速搜索',
    itemRender: {
      name: 'AInput',
    },
    span: 6,
  },
  {
    field: 'town',
    title: '镇',
    itemRender: {
      name: 'ASelect',
      props: {
        options: townData,
      },
    },
    span: 4,
  },
  {
    span: 14,
    align: 'right',
    className: '!pr-0',
    itemRender: {
      name: 'AButtonGroup',
      children: [
        {
          props: { type: 'primary', content: '查询', htmlType: 'submit' },
          attrs: { class: 'mr-2' },
        },
        { props: { type: 'default', htmlType: 'reset', content: '重置' } },
      ],
    },
  },
];

export const formSchema = [
  {
    field: 'stcd',
    label: '测站编码',
    required: true,
    component: 'Input',
  },
  {
    field: 'stnm',
    label: '测站名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'town',
    label: '镇',
    component: 'Select',
    componentProps: {
      options: townData
    },
  },
  {
    field: 'eqId',
    label: '设备编码',
    required: true,
    component: 'Input',
  },

  {
    field: 'eqNo',
    label: '卡号',
    required: true,
    component: 'Input',
  },


  {
    field: 'contacts',
    label: '责任人',
    component: 'Input',
  },
  {
    field: 'contactsPhone',
    label: '联系方式',
    component: 'InputNumber',
  },
  {
    field: 'contactsPosition',
    label: '管理单位',
    component: 'Input',
  },
  /*{
    field: 'stbprpLevel',
    label: '层级',
    component: 'Select',
    defaultValue: 2,
    componentProps: {
      options: [
        { label: '第1层级', value: 2 },
        { label: '第2层级', value: 4 },
        { label: '第3层级', value: 6 },
        { label: '第4层级', value: 8 },
      ]
    },
  },*/
  {
    field: 'lgtd',
    label: '经度',
    component: 'InputNumber',
    colProps: { span: 4 },

  },
  {
    field: 'lttd',
    label: '纬度',
    component: 'InputNumber',
  },
];

export { registerMapModal };
